﻿/// <reference path="underscore.js" />
/// <reference path="Student.js" />
(function () {
	var studentsArray = [
		new Student("Kiro", "Skalata", 5, [5, 6, 4, 5]),
		new Student("Ab", "Cto", 5, [6, 6, 6, 5]),
		new Student("Zya", "Ata", 5, [3, 6, 4, 2])
	];

	function compareNames(students) {
		return _.filter(students, function (student) {
			return student.firstName < student.lastName;
		});
	}

	var comparedStudents = compareNames(studentsArray);

	function sortDesc(students) {
		return _.sortBy(students, function (student) {
			return student.firstName * -1;
		});
	}
	
	console.log("Students ordered and sorted by name: ");
	console.log(sortDesc(comparedStudents));
})();